package day02;

public class DataTypeCastDemo {
    public static void main(String[] args) {
        /*
        char C1 = 'a';
        short C2= (short)C1;
        int C3= C2;
        System.out.println(C3);

        long f =1000000000000000000L;
        int g  =(int)f;//发生了溢出,强转(有可能)发生溢出
        System.out.println(g);

        double a=11.11;
        int b = (int)a;
        System.out.println(b);//发生了精度丢失,强转(有可能)丢失精度

         */
        //byte short char 整数的直接量可以直接赋值给byte、short、char但不能超出范围
        //byte short char 型数据参与运算时,先一律自动转换为int再运算
        byte b1 = 12;
        byte b2 = 17;
        //byte b3 = b1+b2;//报错,b1+b2已经是int类型
        //byte b3 = byte(b1)+b2;//报错,b1和b2本来就是byte类型
        byte b3 = (byte)(b1+b2);
        System.out.println(b3);

        System.out.println('我'+'你'-'你');
        int M ='我';
        System.out.println(M);
        
    }
}
